package com.mini.demos.webgame.handler;

import com.mini.demos.webgame.msg.AbstractGameMsg;
import com.mini.demos.webgame.msg.MsgHead;
import com.mini.demos.webgame.util.CommandConstants;
import com.mini.framework.communicate.mina.handler.Handler;
import com.mini.framework.communicate.mina.handler.HandlerFactory;
import com.mini.framework.communicate.mina.protocol.Msg;

public class GameHandlerFactory implements HandlerFactory {

	public Handler getHandler(Msg msg) {
		AbstractGameMsg message = (AbstractGameMsg)msg;
		MsgHead head = message.getHead();
		switch(head.getCommandId()){
		case CommandConstants.REG:
			return new RegHandler();
		case CommandConstants.LOGIN:
			return new LoginHandler();
		case CommandConstants.JOB:
			return new JobHandler();
		case CommandConstants.JOB_LIST:
			return new JobListHandler();
		}
		
			
		return null;
	}

}
